package com.kefu.sys.vo;

import cn.hutool.core.bean.BeanUtil;
import com.kefu.sys.model.SysTenant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "租户")
public class SysTenantUpdateBossVo extends SysTenantUpdateVo {
    @ApiModelProperty(value = "租户id")
    private String tenantId;

    @ApiModelProperty(value = "坐席数量")
    private Integer userCount;

    @ApiModelProperty(value = "外呼机器人数量")
    private Integer robotCallCount;

    /**
     * 可用通话额度报警阈值
     */
    @ApiModelProperty(value = "可用通话额度报警阈值")
    private Integer quotaAlertThreshold;

    @ApiModelProperty(name = "versionId", value = "版本id")
    private String versionId;

    @ApiModelProperty(value = "租户到期时间")
    private Long expireTime;

    @Override
    public SysTenant convert() {
        SysTenant info = BeanUtil.toBean(this, SysTenant.class);
        info.setTenantName(super.getTenantName());
        info.setTenantStatus(super.getTenantStatus());
        info.setTenantIcon(super.getTenantIcon());
        info.setContactName(super.getContactName());
        info.setContactEmail(super.getContactEmail());
        info.setContactTel(super.getContactTel());
        info.setTenantSecret(super.getTenantSecret());
        if (userCount != null && userCount != 0) {
            info.setUserCount(userCount);
        }
        if(versionId != null){
            info.setVersionId(versionId);
        }

        if(quotaAlertThreshold != null){
            info.setQuotaAlertThreshold(quotaAlertThreshold);
        }

        if (robotCallCount != null && robotCallCount != 0) {
            info.setRobotCallCount(robotCallCount);
        }
        return info;
    }
}